﻿@{
    Layout = "~/Administration/Views/Shared/_AdminPopupLayout.cshtml";
}
@using Nop.Core.Domain.Catalog
@model ProductModel.ProductVariantAttributeModel
@{
    //page title
    ViewBag.Title = T("Admin.Catalog.Products.ProductVariantAttributes.Attributes.ValidationRules").Text;

    var attributeControlType = (AttributeControlType)Model.AttributeControlTypeId;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-catalog.png")" alt="" />
            @T("Admin.Catalog.Products.ProductVariantAttributes.Attributes.ValidationRules")
        </div>
    </div>

    if (ViewBag.RefreshPage == true)
    {
        <script type="text/javascript">
            try {
                window.opener.document.forms['@(ViewBag.formId)'].@(ViewBag.btnId).click();
            } catch (e) {
            }
            window.close();
        </script>
    }
    if (!Model.ValidationRulesAllowed)
    {
        <p>This attribute type cannot have validation rules</p>
    }
    <table width="100%">
        <tr @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ValidationMinLength):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ValidationMinLength)
                @Html.ValidationMessageFor(model => model.ValidationMinLength)
            </td>
        </tr>
        <tr @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ValidationMaxLength):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ValidationMaxLength)
                @Html.ValidationMessageFor(model => model.ValidationMaxLength)
            </td>
        </tr>
        <tr @(attributeControlType != AttributeControlType.FileUpload  ? Html.Raw("style='display: none;'") : null)>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ValidationFileAllowedExtensions):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ValidationFileAllowedExtensions)
                @Html.ValidationMessageFor(model => model.ValidationFileAllowedExtensions)
            </td>
        </tr>
        <tr @(attributeControlType != AttributeControlType.FileUpload ? Html.Raw("style='display: none;'") : null)>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ValidationFileMaximumSize):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ValidationFileMaximumSize)
                @Html.ValidationMessageFor(model => model.ValidationFileMaximumSize)
            </td>
        </tr>
        <tr @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DefaultValue):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DefaultValue)
                @Html.ValidationMessageFor(model => model.DefaultValue)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" class="k-button" value="@T("Admin.Common.Save")" />
            </td>
        </tr>
    </table>
}